import requests


class Base:
    def __init__(self):
        self.s = requests.Session()
        self.token = self.get_token()
        self.s.params = { "access_token":self.token}


    def get_token(self):
        url = "https://qyapi.weixin.qq.com/cgi-bin/gettoken"
        params = {
            "corpid":"wwd429890af578a469",
            "corpsecret":"ooGtHdJ4_w8wn3auYijd-QO9SQmObz1GLBQ7mtW3J74"
        }
        # r=requests.get("https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=wwd429890af578a469&corpsecret=ooGtHdJ4_w8wn3auYijd-QO9SQmObz1GLBQ7mtW3J74")
        #r = requests.get(url,params=params)
        r = requests.get(url,params=params)
        #print(r.json()['access_token'])
        return r.json()['access_token']

    def send(self,*args,**kwargs):
        return  self.s.request(*args,**kwargs)
